<?php
/**
 * Extends core/oxemail.
 * 
 * Used to alter the email that is sent to the customer and shopowner.
 * 
 * @author Klarna
 */
class klarnaEmail extends klarnaEmail_parent {
	
	private $kutil = null;
	private $invoicenumber = '';
	
	protected $_sOrderUserTemplate = 'klarna_email_order_cust_html.tpl';
	protected $_sOrderOwnerTemplate = 'klarna_email_order_owner_html.tpl';
	
	public function __construct() {
		parent::__construct();
		
		$this->kutil = oxNew('klarnautil');
		$this->invoicenumber = $this->kutil->loadEmailSM();
	}
	
	public function sendOrderEmailToOwner($oOrder, $sSubject = null) {
		// create messages
		$oSmarty = oxUtilsView::getInstance()->getSmarty();
		$oSmarty->assign("invoicenumber", $this->invoicenumber);
		$oSmarty->assign("kutil", $this->kutil);
		
		return parent::sendOrderEmailToOwner($oOrder, $sSubject);
	}
	
	public function sendOrderEmailToUser($oOrder, $sSubject = null) {
		// create messages
		$oSmarty = oxUtilsView::getInstance()->getSmarty();
		$oSmarty->assign("invoicenumber", $this->invoicenumber);
		$oSmarty->assign("kutil", $this->kutil);
		
		return parent::sendOrderEmailToUser($oOrder, $sSubject);
	}
}
?>